package com.yumeng.framework.persistence.mybatis.injector;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.yumeng.framework.persistence.mybatis.injector.methods.*;
import org.apache.ibatis.session.Configuration;

import java.util.List;

/**
 * 自定义sql注入
 *
 * @author wxd
 * @date 2021/9/22 16:38
 */
public class MySqlInjector extends DefaultSqlInjector {

    @Override
    public List<AbstractMethod> getMethodList(Configuration configuration, Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(configuration, mapperClass, tableInfo);
        //methodList.add(new DeleteAll());
        //methodList.add(new FindOne());
        //methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));

        methodList.add(new InsertBatch(null));
        methodList.add(new UpdateBatchByIds());

        methodList.add(new LogicDelete());
        methodList.add(new LogicDeleteById());
        methodList.add(new logicDeleteByIds());
        methodList.add(new LogicDeleteByMap());

        //methodList.add(new AlwaysUpdateSomeColumnById());//不考虑是否为null
        //methodList.add(new LogicDeleteByIdWithFill()); 逻辑删除一般不需要考虑填充字段

        return methodList;
    }


}
